package bank.mvc;

import bank.account.AccountFactory;
import framework.Utils;
import framework.account.IAccount;
import framework.customer.ICustomer;
import framework.mvc.ACustomButton;
import framework.mvc.AFincoView;
import framework.mvc.FincoContext;

import java.util.Map;

public class AddPersonButton extends ACustomButton {

    public AddPersonButton(AFincoView view) {
        super(view, "Add Personal Account");
    }

    @Override
    public void fireClick() {
        AddPersonalDialog dialog = new AddPersonalDialog(view);
        dialog.setBounds(450, 20, 300, 360);
        dialog.setVisible(true);
        if (!dialog.isCreated())
            return;

        Map<String, String> cusMap = dialog.getCustomerMap();
        FincoContext.getFinco().addPersonAccunt(cusMap);
    }
}
